# -*- coding: utf-8 -*-
# FileName:     ztips.py
# time:         23/2/1 001 下午 2:07
# Author:       Zhou Hang
# Description:  I don't want to write
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QMessageBox

from src.gui.custom_module import RoundWidget
from src.ui.ztips import Ui_ztips


class ZTips(RoundWidget, Ui_ztips):
    def __init__(self):
        super(ZTips, self).__init__()
        self.setupUi(self)
        self.child = []

        self.setWindowIcon(QIcon('../resources/main_icon.png'))
        exit_img = '../resources/close.png'
        new_img = '../resources/increase.png'
        self.exit_btn.setStyleSheet("QPushButton{\n"
                                    "border-image: url(\"%s\");\n"
                                    "}" % exit_img)
        self.new_btn.setStyleSheet("QPushButton{\n"
                                   "border-image: url(\"%s\");\n"
                                   "}" % new_img)
        self.textEdit.setStyleSheet("QTextEdit{\n"
                                    "background-color: #FFFFCC;\n"
                                    ""
                                    "}")
        # self.textEdit.setTextBackgroundColor(QColor(255, 255, 204, 80))
        self.exit_btn.clicked.connect(self.close)
        self.new_btn.clicked.connect(self.new)

    def closeEvent(self, event):
        reply = QMessageBox.information(self, '提示', "确定关闭该tip？", QMessageBox.Yes | QMessageBox.No,
                                        QMessageBox.No)
        if reply == QMessageBox.Yes:
            event.accept()
        else:
            event.ignore()

    def new(self):
        note = ZTips()
        self.child.append(note)
        note.show()


def main():
    pass


if __name__ == "__main__":
    main()
